UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '7Kqud2yv3IjIloj75yECyV21ENG+TyznpvlD+VqqMpo=' 
WHERE 
  key_id = '329050424c379e216c1678d5964c7c5e794927f49d7cc95d1563362ed9b85ae1' 
  AND (
    token = '7Kqud2yv3IjIloj75yECyV21ENG+TyznpvlD+VqqMpo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035