UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'fLvrtegwG8n/sCFWTItDiR2UuOU6MDKfwR/CRilpu2o=' 
WHERE 
  key_id = 'c48f7b168c774c1c93ca3eb8e6af3df822d20edf7d2866c26bb8851446245316' 
  AND (
    token = 'fLvrtegwG8n/sCFWTItDiR2UuOU6MDKfwR/CRilpu2o=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028