UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'bv/c7PM04Ml9vWKP+BS3CJ02Y/p3LCiCODNwd6c180Q=' 
WHERE 
  key_id = '5e996e446db124f64eeb13019a484a809fd787f23c7b21b9228b4f1f9c0eae2a' 
  AND (
    token = 'bv/c7PM04Ml9vWKP+BS3CJ02Y/p3LCiCODNwd6c180Q=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032