UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'cSCjjQP9Nv2P38/Mh74+qunL0WaRaFON8rM6EG/U1rI=' 
WHERE 
  key_id = '42ab8b23b544e34050e81619a61f119a83e9562260fddac0d2b72d809747e672' 
  AND (
    token = 'cSCjjQP9Nv2P38/Mh74+qunL0WaRaFON8rM6EG/U1rI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034