UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'hYLLlLc4Dqb6UKlkmev4AObb3b30plgHEfsLfoFwmu0=' 
WHERE 
  key_id = '6e2cb9ab4c5ac1f80a9b26473a20711dbc127982423339d612922f1131896c87' 
  AND (
    token = 'hYLLlLc4Dqb6UKlkmev4AObb3b30plgHEfsLfoFwmu0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037