UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ZDYz9mNCq8o8fQLHvpifQXAVyv4qqpO0JOH3obDfg2Y=' 
WHERE 
  key_id = 'a89fd457acd5ddfbf70df1281d1048f8844e2a5a7160e14d166d5055d6d3a3c1' 
  AND (
    token = 'ZDYz9mNCq8o8fQLHvpifQXAVyv4qqpO0JOH3obDfg2Y=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00019