UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'QzSkVcRQINGUmPlV6F0M06eEAx+31Ifs+lWp+XdwLng=' 
WHERE 
  key_id = '76dab2156df172b9293b952cfc5a80f426f256d6d9ee7fac08c400bb2eefa699' 
  AND (
    token = 'QzSkVcRQINGUmPlV6F0M06eEAx+31Ifs+lWp+XdwLng=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029