UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '0jkmCw4RTw7wKvq1Y0jug+XjXyWlZ9LT+UG0LhqepHM=' 
WHERE 
  key_id = '04532733b434607c878e03212ca16d4bc6fa892c74a742e8d82112079e1845ab' 
  AND (
    token = '0jkmCw4RTw7wKvq1Y0jug+XjXyWlZ9LT+UG0LhqepHM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043