UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'uG0AhZM1OPUvxeXdg7cBN9XwaaXrzWzwcBgwzn+v7+8=' 
WHERE 
  key_id = 'bc5c8d8e37461cf0cc29ecc8943469359dcc98834b08f7c4b197e37c98380a8a' 
  AND (
    token = 'uG0AhZM1OPUvxeXdg7cBN9XwaaXrzWzwcBgwzn+v7+8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025