UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'HGu1TJl9Vz1MlRXwB17EqoOTT9xNr6kQf6zxcJ7jiL4=' 
WHERE 
  key_id = '4021999546913d670609736024085ead6fafdd6ac12e7fd90e7f6c384b75cd8d' 
  AND (
    token = 'HGu1TJl9Vz1MlRXwB17EqoOTT9xNr6kQf6zxcJ7jiL4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00052