UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'wPhiwFQaN4wKYvBCOvbXLBgBJuZxmzf5dFKDDC1z4xE=' 
WHERE 
  key_id = '77a43695843af898b74d567895b23de8e89cbfd5f775a98d3fad66732385479b' 
  AND (
    token = 'wPhiwFQaN4wKYvBCOvbXLBgBJuZxmzf5dFKDDC1z4xE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032