UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '3c2sSeEQnMQDF2sR+ce+hGm+jQXFgbPsKP69r6Yb/oM=' 
WHERE 
  key_id = 'b90af0d26f4c86749ca595719c27742d57f9d341e15e405a284c992485640787' 
  AND (
    token = '3c2sSeEQnMQDF2sR+ce+hGm+jQXFgbPsKP69r6Yb/oM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030