UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '04/QboRBYNx0xYz3MxzCsMgGauW5b14eI+XW75pjiy4=' 
WHERE 
  key_id = 'c584165ca4a736a7768782bf45b50daa06f7d5bf96ca45bb5d3a588a089df139' 
  AND (
    token = '04/QboRBYNx0xYz3MxzCsMgGauW5b14eI+XW75pjiy4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033