UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'udjilywO1phVhwZF0Xi5CZTq8SqjF5ACWzE912O2F7Q=' 
WHERE 
  key_id = 'bb9e4e387c7e41c2243892d8c61f2ad088584f417a3eff4cb2e6b77d69c04627' 
  AND (
    token = 'udjilywO1phVhwZF0Xi5CZTq8SqjF5ACWzE912O2F7Q=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00020