UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'CTi3Pd6U8WDDCB3sLqq5lwtVmNPcZalcPcMbyLwVHGI=' 
WHERE 
  key_id = '99f4375b6733c8757c9872124a1d72b2c424bb6b796bdd1b2c5173f3e9ce794f' 
  AND (
    token = 'CTi3Pd6U8WDDCB3sLqq5lwtVmNPcZalcPcMbyLwVHGI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022