UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'wnINeOJjoZGSUIyl6+nM21LsNQVgAdsLsplRgs2aSyQ=' 
WHERE 
  key_id = '8714458030bde7df499178ccf08a72bdcda45fe3ec18b5bb31eb643d5cbb1aa6' 
  AND (
    token = 'wnINeOJjoZGSUIyl6+nM21LsNQVgAdsLsplRgs2aSyQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025