UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'TOgQZXicrMaMIHgrBHkYdAFxyPU4GkPAcTiBsAcmyww=' 
WHERE 
  key_id = '4559193aa7d5fd7fe4e5d2d3841e00488e9bf45cad9f440a1410cebda257d23d' 
  AND (
    token = 'TOgQZXicrMaMIHgrBHkYdAFxyPU4GkPAcTiBsAcmyww=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00064