UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'mQHlO8eHAjTRnR0Y8PzJ3kj0it9jeetz1nfybiPsAOE=' 
WHERE 
  key_id = '57f11c41d849348a77242fc2eec621766dd728bdae5507465676642ab1c455f6' 
  AND (
    token = 'mQHlO8eHAjTRnR0Y8PzJ3kj0it9jeetz1nfybiPsAOE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042