UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'VQ+lL6lO7S3qShpudsOEIfKX8vn9fW8r58e2JZis2Y0=' 
WHERE 
  key_id = '374d7eddd3356c2b6ec4f2e4425eb817f4e3ca2434fe3f1c623c2b671396cd87' 
  AND (
    token = 'VQ+lL6lO7S3qShpudsOEIfKX8vn9fW8r58e2JZis2Y0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031