UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'UIU0vMhHz1XFCYELeU+4N9ghRfXhzfwMBjuQK+yYfoc=' 
WHERE 
  key_id = '5094537916b1253cd5795f8f41faeb064a9c5d0e9a75748ea31fd27dc54ea9f8' 
  AND (
    token = 'UIU0vMhHz1XFCYELeU+4N9ghRfXhzfwMBjuQK+yYfoc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022