UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '4eKEAPhd6tlDNHBgdK31ZpZDsIUT+uQj1Zcy/Daf7mA=' 
WHERE 
  key_id = '945a7139fa6909c0382ba43440885b8397beb6ca6301b23a41c4f975b084d4e6' 
  AND (
    token = '4eKEAPhd6tlDNHBgdK31ZpZDsIUT+uQj1Zcy/Daf7mA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037