UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Cn7iU7nee6OTOMdW02LI9Awr5yHjrnJ907W0jl2XNgA=' 
WHERE 
  key_id = '5b915be9bbc8d151c6c1289a1c50f48d7b2c0a33238d0bb5c182799fb9d51f3f' 
  AND (
    token = 'Cn7iU7nee6OTOMdW02LI9Awr5yHjrnJ907W0jl2XNgA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034