UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'nv0HJDfZp7MJNXWmJwoavHtQu2uUMynMN8aQL39OdrM=' 
WHERE 
  key_id = '50f03072f023a3b6ade79ed42b4df53acfca2fa85a5eae5615528258f93866a4' 
  AND (
    token = 'nv0HJDfZp7MJNXWmJwoavHtQu2uUMynMN8aQL39OdrM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032