UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'C25aDvkSfmc9i5nNe6byIRxQ4RrEMCbZ2te1MLQ8Ads=' 
WHERE 
  key_id = '174a4d97709612dbd993c5cd79b0e56feaef15879cdc5a153085c508b54ce2ff' 
  AND (
    token = 'C25aDvkSfmc9i5nNe6byIRxQ4RrEMCbZ2te1MLQ8Ads=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028