UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'SROsfyRIy41YnLSDRkcsI4lqt+j5SBdRbcl/E4UepTw=' 
WHERE 
  key_id = 'e07bdb6d34a59cec3449601cb96ce251c0e9fc345511a874508faff1382c6f14' 
  AND (
    token = 'SROsfyRIy41YnLSDRkcsI4lqt+j5SBdRbcl/E4UepTw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00055