UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'sA5Jrs0WTOzxvTyTFMybUPt0Itdoc+fch8Tf7Unld7U=' 
WHERE 
  key_id = '9f90fdc4eba5cb0bd39d26a6baf9f36f59558c05bd9375db276ec5cb68fc0731' 
  AND (
    token = 'sA5Jrs0WTOzxvTyTFMybUPt0Itdoc+fch8Tf7Unld7U=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042