UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'hsIsH6/ooBWRpxrMEUW37UprFhm+T/wrU3yLAxiLnPc=' 
WHERE 
  key_id = 'ac3b96e9a8d04ed123e19e683a4ca16f094e75374e6d47dec3229dd1e9b24f1b' 
  AND (
    token = 'hsIsH6/ooBWRpxrMEUW37UprFhm+T/wrU3yLAxiLnPc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031