UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Lifg+66rbyz/rD7GuO1t7bcXxxCNqKgkZz8Ad55ukPk=' 
WHERE 
  key_id = 'e52579457de737fdaca90953996d942e05d102513e5b068fe77378b8a57a5ef7' 
  AND (
    token = 'Lifg+66rbyz/rD7GuO1t7bcXxxCNqKgkZz8Ad55ukPk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039