UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '+bv132hR/V751dgrOcEz2cE82s9O3t+gAKjOKMHZuXQ=' 
WHERE 
  key_id = '881cd2cc59c0dfaf55bd5edfd14a278216169fac30aef98a9a2e7b614b0e6385' 
  AND (
    token = '+bv132hR/V751dgrOcEz2cE82s9O3t+gAKjOKMHZuXQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026