UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'xkgxwI+zG3yrWeObROYtGJtD+qc9zRT3sIazcskMiEY=' 
WHERE 
  key_id = '7f2d3acfecaf39368f5e21418e350f9b1d4b8a096a27c13fe1363811dfce4f71' 
  AND (
    token = 'xkgxwI+zG3yrWeObROYtGJtD+qc9zRT3sIazcskMiEY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023