UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'BsgWV030l+z+WZNZdGdD06tpjC5l4LlMjEAJ/Acd+5o=' 
WHERE 
  key_id = '631626c08bc416e74c7440e7e1e5f68988d85c34dc269e42018ccef08ec96ea3' 
  AND (
    token = 'BsgWV030l+z+WZNZdGdD06tpjC5l4LlMjEAJ/Acd+5o=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026