UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Z+jqrVWkg3T5k6hLlGZygeQNDyOgLkLHry5BrTHmZz0=' 
WHERE 
  key_id = '258b082c269656f7f47d9458878f7bd52c43ab144a83d8f8a8b071bf01c9a44c' 
  AND (
    token = 'Z+jqrVWkg3T5k6hLlGZygeQNDyOgLkLHry5BrTHmZz0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00047