UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'HAGnGFXN9P0H5++u0GSevU38xI1hmf4LI3upVOxaUIs=' 
WHERE 
  key_id = '8dca21484fa4dc3679475fea4e8057409bc791df5c16ae6ea070a9fd7af7eb12' 
  AND (
    token = 'HAGnGFXN9P0H5++u0GSevU38xI1hmf4LI3upVOxaUIs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032